#include "enemyplane.h"
#include "config.h"

EnemyPlane::EnemyPlane()
{
    //加载资源
    m_enemy.load(ENEMY_PATH);

    //坐标
    m_X = 0;
    m_Y = 0;

    //速度
    m_Speed = ENEMY_SPEED;

    //矩形框
    m_Rect.setWidth(m_enemy.width());
    m_Rect.setHeight(m_enemy.height());
    m_Rect.moveTo(m_X, m_Y);

    //是否闲置
    m_Free = true;

    //爆炸状态
    m_Down = -1;
}

/* 更新敌机坐标 */
void EnemyPlane::updatePosition()
{
    if(m_Free)
    {
        return;
    }
    m_Y += m_Speed;
    m_Rect.moveTo(m_X,m_Y);
    //如果超出
    if(m_Y >= GAME_HEIGHT + m_Rect.height())
    {
        m_Free =  true;
    }
}


